import Typography, {TypographyProps} from "@mui/material/Typography";
import {FC, ReactNode} from "react";

interface DGTextProps extends TypographyProps {
    children?: ReactNode | string | number | boolean | undefined | null,
    Title?: boolean,
    Body?: boolean,
    Padding?: boolean,
    Bold?: boolean,
}

const DGTextView: FC<DGTextProps> = ({children, Title, Body, Padding, Bold, ...other}) => {

    // 返回标题
    if (Title) return (
        <Typography
            style={{fontWeight: Bold ? "bold" : "normal"}}
            gutterBottom={Padding} variant="h6" component="div"{...other}>
            {children}
        </Typography>);

    // 返回内容文本
    if (Body) return (
        <Typography
            style={{fontWeight: Bold ? "bold" : "normal"}}
            color="text.secondary" variant="subtitle1" {...other}>
            {children}
        </Typography>);

    // 默认文本组件
    return (
        <Typography style={{fontWeight: Bold ? "bold" : "normal"}} color="text.secondary" {...other}>
            {children}
        </Typography>);
}
export default DGTextView;